package com.wxtt.android.dialog;

import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.view.WindowManager;
import android.widget.LinearLayout;
import com.fast.dev.frame.utils.UIUtils;
import com.wxtt.android.R;

/**
 * 说明：分享对话框
 * <p/>
 * 作者：fanly
 * <p/>
 * 时间：2016/2/23 11:01
 * <p/>
 * 版本：verson 1.0
 */
public class ShareDialog extends BaseDialog {

    private LinearLayout ll_wechat,ll_wxcircle;
    private View mView;
    private ShareListener mListener;

    public ShareDialog(Context context,ShareListener listener) {
        super(context,R.style.ShareSheetStyles);
        this.mListener = listener;
    }

    @Override
    public void onInit() {
        mView = getDialogView();
        ll_wechat = (LinearLayout) mView.findViewById(R.id.ll_dialog_wechat);
        ll_wxcircle = (LinearLayout) mView.findViewById(R.id.ll_dialog_wxcircle);
        ll_wechat.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mListener != null){
                    mListener.shareWechat();
                }
            }
        });
        ll_wxcircle.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mListener != null) {
                    mListener.shareWxcircle();
                }
            }
        });
        WindowManager.LayoutParams wmlp = getWindow().getAttributes();
        wmlp.gravity = Gravity.BOTTOM;
        onWindowAttributesChanged(wmlp);

        mView.setMinimumWidth(UIUtils.screenWidth());
    }

    @Override
    public int setDialogView() {
        return R.layout.dialog_share;
    }

    /**
     * 说明：分享监听
     */
    public interface ShareListener{
        void shareWechat();
        void shareWxcircle();
    }
}
